package com.fenyin.samples.study.jvm.memory;  

import java.util.ArrayList;
import java.util.List;

/**
 * VM args:-XX:PermSize=10M -XX:MaxPermSize=10M
 *@Title:  
 *@Description:运行时常量区内存溢出例子  
 *@Author:fengzhichao  
 *@Since:2012-8-25  
 *@Version:1.1.0
 */
public class ConstantsMemoryError {
	
	public static void main(String[] args){
		List<String> list = new ArrayList<String>();
		int i=0;
		while(true){
			list.add(String.valueOf(i++).intern());
		}
		
//		[GC [DefNew: 4416K->499K(4928K), 0.0037150 secs] 4416K->499K(15872K), 0.0037511 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
//		[GC [DefNew: 4915K->0K(4928K), 0.0037547 secs] 4915K->930K(15872K), 0.0037851 secs] [Times: user=0.00 sys=0.00, real=0.00 secs] 
//		[GC [DefNew: 4416K->0K(4928K), 0.0042013 secs] 5346K->2093K(15872K), 0.0042369 secs] [Times: user=0.01 sys=0.00, real=0.02 secs] 
//		[Full GC [Tenured: 2093K->1318K(10944K), 0.0518461 secs] 2461K->1318K(15872K), [Perm : 10239K->10239K(10240K)], 0.0519381 secs] [Times: user=0.05 sys=0.00, real=0.05 secs] 
//		[Full GC [Tenured: 1318K->1318K(10944K), 0.0498136 secs] 1318K->1318K(15936K), [Perm : 10239K->10239K(10240K)], 0.0498569 secs] [Times: user=0.05 sys=0.00, real=0.05 secs] 
//		[Full GC [Tenured: 1318K->154K(10944K), 0.0201627 secs] 1392K->154K(15936K), [Perm : 10239K->372K(10240K)], 0.0202446 secs] [Times: user=0.02 sys=0.00, real=0.02 secs]                                                                                                                       
//		Heap
//		 def new generation   total 4992K, used 164K [0x270f0000, 0x27650000, 0x2c640000)
//		  eden space 4480K,   3% used [0x270f0000, 0x27119110, 0x27550000)
//		  from space 512K,   0% used [0x27550000, 0x27550000, 0x275d0000)
//		  to   space 512K,   0% used [0x275d0000, 0x275d0000, 0x27650000)
//		 tenured generation   total 10944K, used 154K [0x2c640000, 0x2d0f0000, 0x370f0000)
//		   the space 10944K,   1% used [0x2c640000, 0x2c6669b8, 0x2c666a00, 0x2d0f0000)
//		 compacting perm gen  total 10240K, used 372K [0x370f0000, 0x37af0000, 0x37af0000)
//		   the space 10240K,   3% used [0x370f0000, 0x3714d270, 0x3714d400, 0x37af0000)
//		    ro space 10240K,  54% used [0x37af0000, 0x3806c510, 0x3806c600, 0x384f0000)
//		    rw space 12288K,  55% used [0x384f0000, 0x38b8fb78, 0x38b8fc00, 0x390f0000)
	}
}
